package cn.dw.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


import cn.dw.db.JdbcUtil;
import cn.dw.model.Reader;

@SuppressWarnings("deprecation")
public class ReaderDao{

	//	连接对象
	private static Connection conn1=null;
	//	发送sql语句
	private static PreparedStatement stmt1=null;
	//	sql返回的结果集
	private static ResultSet rs1=null;

	public List<Reader> query(){
		String sql = "select 标识列,读者证号,读者姓名,读者单位,读者类别  from vDzxxb where 状态位='N' ";
		try {
			conn1 = JdbcUtil.getConnection();
			stmt1 = conn1.prepareStatement(sql);
			rs1 = stmt1.executeQuery();
			List<Reader> list = new ArrayList<Reader>();
			while(rs1.next()){
				Reader g=new Reader();
				g.setXlh(rs1.getString(1).replaceAll(" +",""));//标识列
				g.setDzzh(rs1.getString(2).replaceAll(" +",""));//读者证号
				g.setDzxm(rs1.getString(3).replaceAll(" +",""));//读者姓名
				g.setDzdw(rs1.getString(4).replaceAll(" +",""));//读者单位
				
				list.add(g);
			}
			return list;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

}
